package com.zeny.online.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.zeny.online.entity.MyFriends;
import com.zeny.online.entity.vo.MyFriendVO;
import com.zeny.online.mapper.MyFriendsMapper;
import com.zeny.online.service.MyFriendsService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author online
 */
@Service
public class MyFriendsServiceImpl extends ServiceImpl<MyFriendsMapper, MyFriends> implements MyFriendsService {

    /**
     * @Description 根据自己的ID和好友ID查询
     * @param myUserId
     * @return com.zeny.online.entity.MyFriends
     **/
    @Override
    public MyFriends findByMyUserIdAndFriendUserId(String myUserId, String friendId) {
        QueryWrapper<MyFriends> wrapper = new QueryWrapper<>();
        wrapper.eq("my_user_id", myUserId);
        wrapper.eq("my_friend_user_id", friendId);
        return baseMapper.selectOne(wrapper);
    }

    /**
     * @Description 获取好友列表
     * @param userId
     * @return java.util.List<com.zeny.online.entity.vo.MyFriendVO>
     **/
    @Override
    public List<MyFriendVO> getMyFriendList(String userId) {
        return baseMapper.getMyFriendList(userId);
    }
}
